home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 11 / Info-Mac_XI_Disc_1.cdr_ / Info-Mac XI Disc 1.cdr / Programs / Science & Math / MacEspresso 1.0 / espresso / utilities.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-10  |  764 b   |  35 lines  |  [TEXT/R*ch]

  1. #include "copyright.h"
  2. #include "port.h"
  3. #include "utility.h"
  4.  
  5. /*
  6.  *  util_print_time -- massage a long which represents a time interval in
  7.  *  milliseconds, into a string suitable for output 
  8.  *
  9.  *  Hack for IBM/PC -- avoids using floating point
  10.  */
  11.  
  12. char *util_print_time(long t)
  13. {
  14.     static char s[40];
  15.  
  16.     (void) sprintf(s, "%ld.%02ld sec", t/1000, (t%1000)/10);
  17.     return s;
  18. }
  19. /*
  20.  *  util_strsav -- save a copy of a string
  21.  */
  22. char *util_strsav(char *s)
  23. {
  24.     return strcpy(ALLOC(char, strlen(s)+1), s);
  25. }
  26. /*
  27.  *   util_cpu_time -- return a long which represents the elapsed processor
  28.  *   time in milliseconds since some constant reference
  29.  */
  30. long util_cpu_time()
  31. {
  32. //on Macs, it's meaningles
  33. return 42;//the meaning of life, universe and everything...
  34. }
  35.